import { glsl2wgslProgram, initGlsl2wgsl } from '@feng3d/glsl2wgsl';

main();

async function main() {
    // 初始化
    await initGlsl2wgsl(); // 初始化 glslang 与 tint

    const result = glsl2wgslProgram({
        vertex: `
        attribute vec4 aVertexPosition;
        attribute vec4 aVertexColor;
    
        uniform mat4 uModelViewMatrix;
        uniform mat4 uProjectionMatrix;
    
        varying lowp vec4 vColor;
    
        void main(void) {
          gl_Position = uProjectionMatrix * uModelViewMatrix * aVertexPosition;
          vColor = aVertexColor;
        }
        `,
        fragment: `
        varying lowp vec4 vColor;
    
        void main(void) {
          gl_FragColor = vColor;
        }
        `,
    });

    console.log(`WebGPU顶点着色器:`);
    console.log(result.vertex)
    console.log(`WebGPU片段着色器:`);
    console.log(result.fragment);
    console.log(`layoutInfo:`);
    console.log(result.layoutInfo);
}
